package com.unionpay.hbase

import org.apache.hadoop.hbase.client.HBaseAdmin
import org.apache.hadoop.hbase.{HBaseConfiguration, HColumnDescriptor, HTableDescriptor, TableName}

object HbaseTest {

  def main(args: Array[String]): Unit = {


    val conf = HBaseConfiguration.create
    conf.set("hbase.zookeeper.quorum", "ls")
    conf.set("hbase.zookeeper.property.clintPort", "2181")
    val hBaseAdmin = new HBaseAdmin(conf)
    creatTable(hBaseAdmin)
    hBaseAdmin.close()
  }

  def creatTable(hBaseAdmin: HBaseAdmin): Unit = {
    val tableName = TableName.valueOf("stock-info")
    val hDescriptor = new HTableDescriptor(tableName)
    hDescriptor.addFamily(new HColumnDescriptor("f"))
    hBaseAdmin.createTable(hDescriptor)
  }

}
